﻿#region Using directives

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="VwKlijentProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract class VwKlijentProviderBaseCore : EntityViewProviderBase<VwKlijent>
	{
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions
		
		/*
		///<summary>
		/// Fill an VList&lt;VwKlijent&gt; From a DataSet
		///</summary>
		/// <param name="dataSet">the DataSet</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList&lt;VwKlijent&gt;"/></returns>
		protected static VList&lt;VwKlijent&gt; Fill(DataSet dataSet, VList<VwKlijent> rows, int start, int pagelen)
		{
			if (dataSet.Tables.Count == 1)
			{
				return Fill(dataSet.Tables[0], rows, start, pagelen);
			}
			else
			{
				return new VList<VwKlijent>();
			}	
		}
		
		
		///<summary>
		/// Fill an VList&lt;VwKlijent&gt; From a DataTable
		///</summary>
		/// <param name="dataTable">the DataTable that hold the data.</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList<VwKlijent>"/></returns>
		protected static VList&lt;VwKlijent&gt; Fill(DataTable dataTable, VList<VwKlijent> rows, int start, int pagelen)
		{
			int recordnum = 0;
			
			System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
			
			while (dataRows.MoveNext() && (pagelen != 0))
			{
				if(recordnum >= start)
				{
					DataRow row = (DataRow)dataRows.Current;
				
					VwKlijent c = new VwKlijent();
					c.ImeKlijenta = (Convert.IsDBNull(row["ImeKlijenta"]))?string.Empty:(System.String)row["ImeKlijenta"];
					c.MB = (Convert.IsDBNull(row["MB"]))?string.Empty:(System.String)row["MB"];
					c.Adresa = (Convert.IsDBNull(row["Adresa"]))?string.Empty:(System.String)row["Adresa"];
					c.Telefon = (Convert.IsDBNull(row["Telefon"]))?string.Empty:(System.String)row["Telefon"];
					c.Telefon2 = (Convert.IsDBNull(row["Telefon2"]))?string.Empty:(System.String)row["Telefon2"];
					c.Fax = (Convert.IsDBNull(row["Fax"]))?string.Empty:(System.String)row["Fax"];
					c.Fax2 = (Convert.IsDBNull(row["Fax2"]))?string.Empty:(System.String)row["Fax2"];
					c.WebAdresa = (Convert.IsDBNull(row["WebAdresa"]))?string.Empty:(System.String)row["WebAdresa"];
					c.ZiroRacun = (Convert.IsDBNull(row["ZiroRacun"]))?string.Empty:(System.String)row["ZiroRacun"];
					c.ZiroRacun2 = (Convert.IsDBNull(row["ZiroRacun2"]))?string.Empty:(System.String)row["ZiroRacun2"];
					c.ZiroRacun3 = (Convert.IsDBNull(row["ZiroRacun3"]))?string.Empty:(System.String)row["ZiroRacun3"];
					c.Napomena1 = (Convert.IsDBNull(row["Napomena1"]))?string.Empty:(System.String)row["Napomena1"];
					c.Napomena2 = (Convert.IsDBNull(row["Napomena2"]))?string.Empty:(System.String)row["Napomena2"];
					c.Naziv = (Convert.IsDBNull(row["Naziv"]))?string.Empty:(System.String)row["Naziv"];
					c.PostanskiBroj = (Convert.IsDBNull(row["PostanskiBroj"]))?(int)0:(System.Int32?)row["PostanskiBroj"];
					c.SifraOpcine = (Convert.IsDBNull(row["SifraOpcine"]))?(int)0:(System.Int32?)row["SifraOpcine"];
					c.Prirez = (Convert.IsDBNull(row["Prirez"]))?0.0F:(System.Single?)row["Prirez"];
					c.ZiroRacunZaPorezPrirez = (Convert.IsDBNull(row["ZiroRacunZaPorezPrirez"]))?string.Empty:(System.String)row["ZiroRacunZaPorezPrirez"];
					c.TipMjesta = (Convert.IsDBNull(row["TipMjesta"]))?(int)0:(System.Int32?)row["TipMjesta"];
					c.KlijentTip = (Convert.IsDBNull(row["KlijentTip"]))?string.Empty:(System.String)row["KlijentTip"];
					c.IDTip = (Convert.IsDBNull(row["IDTip"]))?(int)0:(System.Int32)row["IDTip"];
					c.ID = (Convert.IsDBNull(row["ID"]))?(int)0:(System.Int32)row["ID"];
					c.Broj = (Convert.IsDBNull(row["Broj"]))?string.Empty:(System.String)row["Broj"];
					c.Saldo = (Convert.IsDBNull(row["Saldo"]))?0:(System.Decimal?)row["Saldo"];
					c.SaldoDanas = (Convert.IsDBNull(row["SaldoDanas"]))?0:(System.Decimal?)row["SaldoDanas"];
					c.Oib = (Convert.IsDBNull(row["oib"]))?string.Empty:(System.String)row["oib"];
					c.GarancijaPlacanjaOpis = (Convert.IsDBNull(row["GarancijaPlacanjaOpis"]))?string.Empty:(System.String)row["GarancijaPlacanjaOpis"];
					c.GarancijaPlacanjaVrijednost = (Convert.IsDBNull(row["GarancijaPlacanjaVrijednost"]))?0:(System.Decimal?)row["GarancijaPlacanjaVrijednost"];
					c.DaniOdgodePlacanja = (Convert.IsDBNull(row["DaniOdgodePlacanja"]))?(int)0:(System.Int32?)row["DaniOdgodePlacanja"];
					c.Komentar = (Convert.IsDBNull(row["Komentar"]))?string.Empty:(System.String)row["Komentar"];
					c.AcceptChanges();
					rows.Add(c);
					pagelen -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		*/	
						
		///<summary>
		/// Fill an <see cref="VList&lt;VwKlijent&gt;"/> From a DataReader.
		///</summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pageLength">number of row.</param>
		///<returns>a <see cref="VList&lt;VwKlijent&gt;"/></returns>
		protected VList<VwKlijent> Fill(IDataReader reader, VList<VwKlijent> rows, int start, int pageLength)
		{
			int recordnum = 0;
			while (reader.Read() && (pageLength != 0))
			{
				if(recordnum >= start)
				{
					VwKlijent entity = null;
					if (DataRepository.Provider.UseEntityFactory)
					{
						entity = EntityManager.CreateViewEntity<VwKlijent>("VwKlijent",  DataRepository.Provider.EntityCreationalFactoryType); 
					}
					else
					{
						entity = new VwKlijent();
					}
					entity.ImeKlijenta = (System.String)reader["ImeKlijenta"];
					//entity.ImeKlijenta = (Convert.IsDBNull(reader["ImeKlijenta"]))?string.Empty:(System.String)reader["ImeKlijenta"];
					entity.MB = reader.IsDBNull(reader.GetOrdinal("MB")) ? null : (System.String)reader["MB"];
					//entity.MB = (Convert.IsDBNull(reader["MB"]))?string.Empty:(System.String)reader["MB"];
					entity.Adresa = reader.IsDBNull(reader.GetOrdinal("Adresa")) ? null : (System.String)reader["Adresa"];
					//entity.Adresa = (Convert.IsDBNull(reader["Adresa"]))?string.Empty:(System.String)reader["Adresa"];
					entity.Telefon = reader.IsDBNull(reader.GetOrdinal("Telefon")) ? null : (System.String)reader["Telefon"];
					//entity.Telefon = (Convert.IsDBNull(reader["Telefon"]))?string.Empty:(System.String)reader["Telefon"];
					entity.Telefon2 = reader.IsDBNull(reader.GetOrdinal("Telefon2")) ? null : (System.String)reader["Telefon2"];
					//entity.Telefon2 = (Convert.IsDBNull(reader["Telefon2"]))?string.Empty:(System.String)reader["Telefon2"];
					entity.Fax = reader.IsDBNull(reader.GetOrdinal("Fax")) ? null : (System.String)reader["Fax"];
					//entity.Fax = (Convert.IsDBNull(reader["Fax"]))?string.Empty:(System.String)reader["Fax"];
					entity.Fax2 = reader.IsDBNull(reader.GetOrdinal("Fax2")) ? null : (System.String)reader["Fax2"];
					//entity.Fax2 = (Convert.IsDBNull(reader["Fax2"]))?string.Empty:(System.String)reader["Fax2"];
					entity.WebAdresa = reader.IsDBNull(reader.GetOrdinal("WebAdresa")) ? null : (System.String)reader["WebAdresa"];
					//entity.WebAdresa = (Convert.IsDBNull(reader["WebAdresa"]))?string.Empty:(System.String)reader["WebAdresa"];
					entity.ZiroRacun = reader.IsDBNull(reader.GetOrdinal("ZiroRacun")) ? null : (System.String)reader["ZiroRacun"];
					//entity.ZiroRacun = (Convert.IsDBNull(reader["ZiroRacun"]))?string.Empty:(System.String)reader["ZiroRacun"];
					entity.ZiroRacun2 = reader.IsDBNull(reader.GetOrdinal("ZiroRacun2")) ? null : (System.String)reader["ZiroRacun2"];
					//entity.ZiroRacun2 = (Convert.IsDBNull(reader["ZiroRacun2"]))?string.Empty:(System.String)reader["ZiroRacun2"];
					entity.ZiroRacun3 = reader.IsDBNull(reader.GetOrdinal("ZiroRacun3")) ? null : (System.String)reader["ZiroRacun3"];
					//entity.ZiroRacun3 = (Convert.IsDBNull(reader["ZiroRacun3"]))?string.Empty:(System.String)reader["ZiroRacun3"];
					entity.Napomena1 = reader.IsDBNull(reader.GetOrdinal("Napomena1")) ? null : (System.String)reader["Napomena1"];
					//entity.Napomena1 = (Convert.IsDBNull(reader["Napomena1"]))?string.Empty:(System.String)reader["Napomena1"];
					entity.Napomena2 = reader.IsDBNull(reader.GetOrdinal("Napomena2")) ? null : (System.String)reader["Napomena2"];
					//entity.Napomena2 = (Convert.IsDBNull(reader["Napomena2"]))?string.Empty:(System.String)reader["Napomena2"];
					entity.Naziv = (System.String)reader["Naziv"];
					//entity.Naziv = (Convert.IsDBNull(reader["Naziv"]))?string.Empty:(System.String)reader["Naziv"];
					entity.PostanskiBroj = reader.IsDBNull(reader.GetOrdinal("PostanskiBroj")) ? null : (System.Int32?)reader["PostanskiBroj"];
					//entity.PostanskiBroj = (Convert.IsDBNull(reader["PostanskiBroj"]))?(int)0:(System.Int32?)reader["PostanskiBroj"];
					entity.SifraOpcine = reader.IsDBNull(reader.GetOrdinal("SifraOpcine")) ? null : (System.Int32?)reader["SifraOpcine"];
					//entity.SifraOpcine = (Convert.IsDBNull(reader["SifraOpcine"]))?(int)0:(System.Int32?)reader["SifraOpcine"];
					entity.Prirez = reader.IsDBNull(reader.GetOrdinal("Prirez")) ? null : (System.Single?)reader["Prirez"];
					//entity.Prirez = (Convert.IsDBNull(reader["Prirez"]))?0.0F:(System.Single?)reader["Prirez"];
					entity.ZiroRacunZaPorezPrirez = reader.IsDBNull(reader.GetOrdinal("ZiroRacunZaPorezPrirez")) ? null : (System.String)reader["ZiroRacunZaPorezPrirez"];
					//entity.ZiroRacunZaPorezPrirez = (Convert.IsDBNull(reader["ZiroRacunZaPorezPrirez"]))?string.Empty:(System.String)reader["ZiroRacunZaPorezPrirez"];
					entity.TipMjesta = reader.IsDBNull(reader.GetOrdinal("TipMjesta")) ? null : (System.Int32?)reader["TipMjesta"];
					//entity.TipMjesta = (Convert.IsDBNull(reader["TipMjesta"]))?(int)0:(System.Int32?)reader["TipMjesta"];
					entity.KlijentTip = (System.String)reader["KlijentTip"];
					//entity.KlijentTip = (Convert.IsDBNull(reader["KlijentTip"]))?string.Empty:(System.String)reader["KlijentTip"];
					entity.IDTip = (System.Int32)reader["IDTip"];
					//entity.IDTip = (Convert.IsDBNull(reader["IDTip"]))?(int)0:(System.Int32)reader["IDTip"];
					entity.ID = (System.Int32)reader["ID"];
					//entity.ID = (Convert.IsDBNull(reader["ID"]))?(int)0:(System.Int32)reader["ID"];
					entity.Broj = reader.IsDBNull(reader.GetOrdinal("Broj")) ? null : (System.String)reader["Broj"];
					//entity.Broj = (Convert.IsDBNull(reader["Broj"]))?string.Empty:(System.String)reader["Broj"];
					entity.Saldo = reader.IsDBNull(reader.GetOrdinal("Saldo")) ? null : (System.Decimal?)reader["Saldo"];
					//entity.Saldo = (Convert.IsDBNull(reader["Saldo"]))?0:(System.Decimal?)reader["Saldo"];
					entity.SaldoDanas = reader.IsDBNull(reader.GetOrdinal("SaldoDanas")) ? null : (System.Decimal?)reader["SaldoDanas"];
					//entity.SaldoDanas = (Convert.IsDBNull(reader["SaldoDanas"]))?0:(System.Decimal?)reader["SaldoDanas"];
					entity.Oib = reader.IsDBNull(reader.GetOrdinal("oib")) ? null : (System.String)reader["oib"];
					//entity.Oib = (Convert.IsDBNull(reader["oib"]))?string.Empty:(System.String)reader["oib"];
					entity.GarancijaPlacanjaOpis = reader.IsDBNull(reader.GetOrdinal("GarancijaPlacanjaOpis")) ? null : (System.String)reader["GarancijaPlacanjaOpis"];
					//entity.GarancijaPlacanjaOpis = (Convert.IsDBNull(reader["GarancijaPlacanjaOpis"]))?string.Empty:(System.String)reader["GarancijaPlacanjaOpis"];
					entity.GarancijaPlacanjaVrijednost = reader.IsDBNull(reader.GetOrdinal("GarancijaPlacanjaVrijednost")) ? null : (System.Decimal?)reader["GarancijaPlacanjaVrijednost"];
					//entity.GarancijaPlacanjaVrijednost = (Convert.IsDBNull(reader["GarancijaPlacanjaVrijednost"]))?0:(System.Decimal?)reader["GarancijaPlacanjaVrijednost"];
					entity.DaniOdgodePlacanja = reader.IsDBNull(reader.GetOrdinal("DaniOdgodePlacanja")) ? null : (System.Int32?)reader["DaniOdgodePlacanja"];
					//entity.DaniOdgodePlacanja = (Convert.IsDBNull(reader["DaniOdgodePlacanja"]))?(int)0:(System.Int32?)reader["DaniOdgodePlacanja"];
					entity.Komentar = reader.IsDBNull(reader.GetOrdinal("Komentar")) ? null : (System.String)reader["Komentar"];
					//entity.Komentar = (Convert.IsDBNull(reader["Komentar"]))?string.Empty:(System.String)reader["Komentar"];
					entity.AcceptChanges();
					rows.Add(entity);
					pageLength -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		
		
		/// <summary>
		/// Refreshes the <see cref="VwKlijent"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="VwKlijent"/> object to refresh.</param>
		protected void RefreshEntity(IDataReader reader, VwKlijent entity)
		{
			reader.Read();
			entity.ImeKlijenta = (System.String)reader["ImeKlijenta"];
			//entity.ImeKlijenta = (Convert.IsDBNull(reader["ImeKlijenta"]))?string.Empty:(System.String)reader["ImeKlijenta"];
			entity.MB = reader.IsDBNull(reader.GetOrdinal("MB")) ? null : (System.String)reader["MB"];
			//entity.MB = (Convert.IsDBNull(reader["MB"]))?string.Empty:(System.String)reader["MB"];
			entity.Adresa = reader.IsDBNull(reader.GetOrdinal("Adresa")) ? null : (System.String)reader["Adresa"];
			//entity.Adresa = (Convert.IsDBNull(reader["Adresa"]))?string.Empty:(System.String)reader["Adresa"];
			entity.Telefon = reader.IsDBNull(reader.GetOrdinal("Telefon")) ? null : (System.String)reader["Telefon"];
			//entity.Telefon = (Convert.IsDBNull(reader["Telefon"]))?string.Empty:(System.String)reader["Telefon"];
			entity.Telefon2 = reader.IsDBNull(reader.GetOrdinal("Telefon2")) ? null : (System.String)reader["Telefon2"];
			//entity.Telefon2 = (Convert.IsDBNull(reader["Telefon2"]))?string.Empty:(System.String)reader["Telefon2"];
			entity.Fax = reader.IsDBNull(reader.GetOrdinal("Fax")) ? null : (System.String)reader["Fax"];
			//entity.Fax = (Convert.IsDBNull(reader["Fax"]))?string.Empty:(System.String)reader["Fax"];
			entity.Fax2 = reader.IsDBNull(reader.GetOrdinal("Fax2")) ? null : (System.String)reader["Fax2"];
			//entity.Fax2 = (Convert.IsDBNull(reader["Fax2"]))?string.Empty:(System.String)reader["Fax2"];
			entity.WebAdresa = reader.IsDBNull(reader.GetOrdinal("WebAdresa")) ? null : (System.String)reader["WebAdresa"];
			//entity.WebAdresa = (Convert.IsDBNull(reader["WebAdresa"]))?string.Empty:(System.String)reader["WebAdresa"];
			entity.ZiroRacun = reader.IsDBNull(reader.GetOrdinal("ZiroRacun")) ? null : (System.String)reader["ZiroRacun"];
			//entity.ZiroRacun = (Convert.IsDBNull(reader["ZiroRacun"]))?string.Empty:(System.String)reader["ZiroRacun"];
			entity.ZiroRacun2 = reader.IsDBNull(reader.GetOrdinal("ZiroRacun2")) ? null : (System.String)reader["ZiroRacun2"];
			//entity.ZiroRacun2 = (Convert.IsDBNull(reader["ZiroRacun2"]))?string.Empty:(System.String)reader["ZiroRacun2"];
			entity.ZiroRacun3 = reader.IsDBNull(reader.GetOrdinal("ZiroRacun3")) ? null : (System.String)reader["ZiroRacun3"];
			//entity.ZiroRacun3 = (Convert.IsDBNull(reader["ZiroRacun3"]))?string.Empty:(System.String)reader["ZiroRacun3"];
			entity.Napomena1 = reader.IsDBNull(reader.GetOrdinal("Napomena1")) ? null : (System.String)reader["Napomena1"];
			//entity.Napomena1 = (Convert.IsDBNull(reader["Napomena1"]))?string.Empty:(System.String)reader["Napomena1"];
			entity.Napomena2 = reader.IsDBNull(reader.GetOrdinal("Napomena2")) ? null : (System.String)reader["Napomena2"];
			//entity.Napomena2 = (Convert.IsDBNull(reader["Napomena2"]))?string.Empty:(System.String)reader["Napomena2"];
			entity.Naziv = (System.String)reader["Naziv"];
			//entity.Naziv = (Convert.IsDBNull(reader["Naziv"]))?string.Empty:(System.String)reader["Naziv"];
			entity.PostanskiBroj = reader.IsDBNull(reader.GetOrdinal("PostanskiBroj")) ? null : (System.Int32?)reader["PostanskiBroj"];
			//entity.PostanskiBroj = (Convert.IsDBNull(reader["PostanskiBroj"]))?(int)0:(System.Int32?)reader["PostanskiBroj"];
			entity.SifraOpcine = reader.IsDBNull(reader.GetOrdinal("SifraOpcine")) ? null : (System.Int32?)reader["SifraOpcine"];
			//entity.SifraOpcine = (Convert.IsDBNull(reader["SifraOpcine"]))?(int)0:(System.Int32?)reader["SifraOpcine"];
			entity.Prirez = reader.IsDBNull(reader.GetOrdinal("Prirez")) ? null : (System.Single?)reader["Prirez"];
			//entity.Prirez = (Convert.IsDBNull(reader["Prirez"]))?0.0F:(System.Single?)reader["Prirez"];
			entity.ZiroRacunZaPorezPrirez = reader.IsDBNull(reader.GetOrdinal("ZiroRacunZaPorezPrirez")) ? null : (System.String)reader["ZiroRacunZaPorezPrirez"];
			//entity.ZiroRacunZaPorezPrirez = (Convert.IsDBNull(reader["ZiroRacunZaPorezPrirez"]))?string.Empty:(System.String)reader["ZiroRacunZaPorezPrirez"];
			entity.TipMjesta = reader.IsDBNull(reader.GetOrdinal("TipMjesta")) ? null : (System.Int32?)reader["TipMjesta"];
			//entity.TipMjesta = (Convert.IsDBNull(reader["TipMjesta"]))?(int)0:(System.Int32?)reader["TipMjesta"];
			entity.KlijentTip = (System.String)reader["KlijentTip"];
			//entity.KlijentTip = (Convert.IsDBNull(reader["KlijentTip"]))?string.Empty:(System.String)reader["KlijentTip"];
			entity.IDTip = (System.Int32)reader["IDTip"];
			//entity.IDTip = (Convert.IsDBNull(reader["IDTip"]))?(int)0:(System.Int32)reader["IDTip"];
			entity.ID = (System.Int32)reader["ID"];
			//entity.ID = (Convert.IsDBNull(reader["ID"]))?(int)0:(System.Int32)reader["ID"];
			entity.Broj = reader.IsDBNull(reader.GetOrdinal("Broj")) ? null : (System.String)reader["Broj"];
			//entity.Broj = (Convert.IsDBNull(reader["Broj"]))?string.Empty:(System.String)reader["Broj"];
			entity.Saldo = reader.IsDBNull(reader.GetOrdinal("Saldo")) ? null : (System.Decimal?)reader["Saldo"];
			//entity.Saldo = (Convert.IsDBNull(reader["Saldo"]))?0:(System.Decimal?)reader["Saldo"];
			entity.SaldoDanas = reader.IsDBNull(reader.GetOrdinal("SaldoDanas")) ? null : (System.Decimal?)reader["SaldoDanas"];
			//entity.SaldoDanas = (Convert.IsDBNull(reader["SaldoDanas"]))?0:(System.Decimal?)reader["SaldoDanas"];
			entity.Oib = reader.IsDBNull(reader.GetOrdinal("oib")) ? null : (System.String)reader["oib"];
			//entity.Oib = (Convert.IsDBNull(reader["oib"]))?string.Empty:(System.String)reader["oib"];
			entity.GarancijaPlacanjaOpis = reader.IsDBNull(reader.GetOrdinal("GarancijaPlacanjaOpis")) ? null : (System.String)reader["GarancijaPlacanjaOpis"];
			//entity.GarancijaPlacanjaOpis = (Convert.IsDBNull(reader["GarancijaPlacanjaOpis"]))?string.Empty:(System.String)reader["GarancijaPlacanjaOpis"];
			entity.GarancijaPlacanjaVrijednost = reader.IsDBNull(reader.GetOrdinal("GarancijaPlacanjaVrijednost")) ? null : (System.Decimal?)reader["GarancijaPlacanjaVrijednost"];
			//entity.GarancijaPlacanjaVrijednost = (Convert.IsDBNull(reader["GarancijaPlacanjaVrijednost"]))?0:(System.Decimal?)reader["GarancijaPlacanjaVrijednost"];
			entity.DaniOdgodePlacanja = reader.IsDBNull(reader.GetOrdinal("DaniOdgodePlacanja")) ? null : (System.Int32?)reader["DaniOdgodePlacanja"];
			//entity.DaniOdgodePlacanja = (Convert.IsDBNull(reader["DaniOdgodePlacanja"]))?(int)0:(System.Int32?)reader["DaniOdgodePlacanja"];
			entity.Komentar = reader.IsDBNull(reader.GetOrdinal("Komentar")) ? null : (System.String)reader["Komentar"];
			//entity.Komentar = (Convert.IsDBNull(reader["Komentar"]))?string.Empty:(System.String)reader["Komentar"];
			reader.Close();
	
			entity.AcceptChanges();
		}
		
		/*
		/// <summary>
		/// Refreshes the <see cref="VwKlijent"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="VwKlijent"/> object.</param>
		protected static void RefreshEntity(DataSet dataSet, VwKlijent entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.ImeKlijenta = (Convert.IsDBNull(dataRow["ImeKlijenta"]))?string.Empty:(System.String)dataRow["ImeKlijenta"];
			entity.MB = (Convert.IsDBNull(dataRow["MB"]))?string.Empty:(System.String)dataRow["MB"];
			entity.Adresa = (Convert.IsDBNull(dataRow["Adresa"]))?string.Empty:(System.String)dataRow["Adresa"];
			entity.Telefon = (Convert.IsDBNull(dataRow["Telefon"]))?string.Empty:(System.String)dataRow["Telefon"];
			entity.Telefon2 = (Convert.IsDBNull(dataRow["Telefon2"]))?string.Empty:(System.String)dataRow["Telefon2"];
			entity.Fax = (Convert.IsDBNull(dataRow["Fax"]))?string.Empty:(System.String)dataRow["Fax"];
			entity.Fax2 = (Convert.IsDBNull(dataRow["Fax2"]))?string.Empty:(System.String)dataRow["Fax2"];
			entity.WebAdresa = (Convert.IsDBNull(dataRow["WebAdresa"]))?string.Empty:(System.String)dataRow["WebAdresa"];
			entity.ZiroRacun = (Convert.IsDBNull(dataRow["ZiroRacun"]))?string.Empty:(System.String)dataRow["ZiroRacun"];
			entity.ZiroRacun2 = (Convert.IsDBNull(dataRow["ZiroRacun2"]))?string.Empty:(System.String)dataRow["ZiroRacun2"];
			entity.ZiroRacun3 = (Convert.IsDBNull(dataRow["ZiroRacun3"]))?string.Empty:(System.String)dataRow["ZiroRacun3"];
			entity.Napomena1 = (Convert.IsDBNull(dataRow["Napomena1"]))?string.Empty:(System.String)dataRow["Napomena1"];
			entity.Napomena2 = (Convert.IsDBNull(dataRow["Napomena2"]))?string.Empty:(System.String)dataRow["Napomena2"];
			entity.Naziv = (Convert.IsDBNull(dataRow["Naziv"]))?string.Empty:(System.String)dataRow["Naziv"];
			entity.PostanskiBroj = (Convert.IsDBNull(dataRow["PostanskiBroj"]))?(int)0:(System.Int32?)dataRow["PostanskiBroj"];
			entity.SifraOpcine = (Convert.IsDBNull(dataRow["SifraOpcine"]))?(int)0:(System.Int32?)dataRow["SifraOpcine"];
			entity.Prirez = (Convert.IsDBNull(dataRow["Prirez"]))?0.0F:(System.Single?)dataRow["Prirez"];
			entity.ZiroRacunZaPorezPrirez = (Convert.IsDBNull(dataRow["ZiroRacunZaPorezPrirez"]))?string.Empty:(System.String)dataRow["ZiroRacunZaPorezPrirez"];
			entity.TipMjesta = (Convert.IsDBNull(dataRow["TipMjesta"]))?(int)0:(System.Int32?)dataRow["TipMjesta"];
			entity.KlijentTip = (Convert.IsDBNull(dataRow["KlijentTip"]))?string.Empty:(System.String)dataRow["KlijentTip"];
			entity.IDTip = (Convert.IsDBNull(dataRow["IDTip"]))?(int)0:(System.Int32)dataRow["IDTip"];
			entity.ID = (Convert.IsDBNull(dataRow["ID"]))?(int)0:(System.Int32)dataRow["ID"];
			entity.Broj = (Convert.IsDBNull(dataRow["Broj"]))?string.Empty:(System.String)dataRow["Broj"];
			entity.Saldo = (Convert.IsDBNull(dataRow["Saldo"]))?0:(System.Decimal?)dataRow["Saldo"];
			entity.SaldoDanas = (Convert.IsDBNull(dataRow["SaldoDanas"]))?0:(System.Decimal?)dataRow["SaldoDanas"];
			entity.Oib = (Convert.IsDBNull(dataRow["oib"]))?string.Empty:(System.String)dataRow["oib"];
			entity.GarancijaPlacanjaOpis = (Convert.IsDBNull(dataRow["GarancijaPlacanjaOpis"]))?string.Empty:(System.String)dataRow["GarancijaPlacanjaOpis"];
			entity.GarancijaPlacanjaVrijednost = (Convert.IsDBNull(dataRow["GarancijaPlacanjaVrijednost"]))?0:(System.Decimal?)dataRow["GarancijaPlacanjaVrijednost"];
			entity.DaniOdgodePlacanja = (Convert.IsDBNull(dataRow["DaniOdgodePlacanja"]))?(int)0:(System.Int32?)dataRow["DaniOdgodePlacanja"];
			entity.Komentar = (Convert.IsDBNull(dataRow["Komentar"]))?string.Empty:(System.String)dataRow["Komentar"];
			entity.AcceptChanges();
		}
		*/
			
		#endregion Helper Functions
	}//end class

	#region VwKlijentFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwKlijent"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwKlijentFilterBuilder : SqlFilterBuilder<VwKlijentColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwKlijentFilterBuilder class.
		/// </summary>
		public VwKlijentFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwKlijentFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwKlijentFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwKlijentFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwKlijentFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwKlijentFilterBuilder

	#region VwKlijentParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwKlijent"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwKlijentParameterBuilder : ParameterizedSqlFilterBuilder<VwKlijentColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwKlijentParameterBuilder class.
		/// </summary>
		public VwKlijentParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwKlijentParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwKlijentParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwKlijentParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwKlijentParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwKlijentParameterBuilder
} // end namespace
